package com.xiemingtian.navdemo.home


import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

import com.xiemingtian.navdemo.R
import com.xiemingtian.navdemo.SimpleActivity
import kotlinx.android.synthetic.main.fragment_main.*


class MainFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_main, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val name = arguments?.getString("name") ?: "unknown"
        nameLabel.text = "Hello $name"

        jumpSimple.setOnClickListener {
            val intent = Intent(context, SimpleActivity::class.java)
            startActivity(intent)
        }

    }


}
